package com.example.recyclerviewtest;

import androidx.appcompat.app.AppCompatActivity;


import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;


public class MainActivity extends AppCompatActivity  implements View.OnClickListener{


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        //按钮监听事件
        Button button1=(Button)findViewById(R.id.button1);
        button1.setOnClickListener(this);

        Button button2=(Button)findViewById(R.id.button2);
        button2.setOnClickListener(this);

        Button button3=(Button)findViewById(R.id.button3);
        button3.setOnClickListener(this);

        Button button4=(Button)findViewById(R.id.button4);
        button4.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.button1:
                Toast.makeText(MainActivity.this,"kkkkk",Toast.LENGTH_SHORT).show();
                Intent intent1=new Intent(MainActivity.this, LinearLayout.class);
                startActivity(intent1);
                break;
            case R.id.button2:
                Intent intent2=new Intent(MainActivity.this, GridLayout.class);
                startActivity(intent2);
                break;
            case R.id.button3:
                Intent intent3=new Intent(MainActivity.this, StaggeredGridLayout.class);
                startActivity(intent3);
                break;
//            case R.id.button4:
//                Intent intent4=new Intent(MainActivity.this, baifenbiLayoutActivity.class);
//                startActivity(intent4);
//                break;

        }
    }
}
